#include "../xglog/xglog.h"
void test(const std::string &name)
{
  // 这两个是默认的
  INFO("%s", "测试开始");
  xglog::Logger::ptr logger = xglog::LoggerManger::getInstance().getLogger(name);
  logger->debug("%s", "测试日志");
  logger->info("%s", "测试日志");
  logger->warn("%s", "测试日志");
  logger->error("%s", "测试日志");
  logger->fatal("%s", "测试日志");
  INFO("%s", "测试结束");
}
int main()
{
  std::unique_ptr<xglog::LoggerBuilder> builder(new xglog::globalLoggerBuilder());
  builder->buildLoggername("async_logger");
  builder->buildLoggerlevel(xglog::LogLevel::value ::WARN);
  builder->buildFormater("[%c][%f:%l]%m%n");
  builder->buildLoggerType(xglog::LoggerType::LOGGER_ASYNC);
  builder->buildSink<xglog::StdoutSink>();
  builder->buildSink<xglog::FileSink>("./logfile/test.log");
  builder->buildSink<xglog::RollBySizeSink>("./logfile/roll-", 1024 * 1024);
  builder->build();
  test("async_logger");
  return 0;
}